﻿
using System.Text.RegularExpressions;
namespace Wicresoft.EKA.NRemedy.CodeGenerate
{
    public class GetARFormFilterDelegate
    {
        #region defined form filter

        public static bool FormFilterBase(BMC.ARSystem.ARForm form)
        {
            if (form == null) return false;
            return true;
        }

        public static bool FormFilterIsDisplayOnlyForm(BMC.ARSystem.ARForm form)
        {
            if (form is BMC.ARSystem.DisplayOnlyForm) return true;
            return false;
        }

        public static bool FormFilterIsRegularForm(BMC.ARSystem.ARForm form)
        {
            if (form is BMC.ARSystem.RegularForm) return true;
            return false;
        }

        public static bool FormFilterIsJoinForm(BMC.ARSystem.ARForm form)
        {
            if (form is BMC.ARSystem.JoinForm) return true;
            return false;
        }

        public static bool FormFilterIsVendorForm(BMC.ARSystem.ARForm form)
        {
            if (form is BMC.ARSystem.VendorForm) return true;
            return false;
        }

        public static bool FormFilterIsViewForm(BMC.ARSystem.ARForm form)
        {
            if (form is BMC.ARSystem.ViewForm) return true;
            return false;
        }

        public static bool FormFilterWithRegex(BMC.ARSystem.ARForm form, string pattern)
        {
            if (string.IsNullOrEmpty(pattern)) return true;
            if (Regex.Match(form.Name, pattern, RegexOptions.IgnoreCase).Value == form.Name) return true;
            return false;
        }

        public static bool FormFilterWithContain(BMC.ARSystem.ARForm form, string contain)
        {
            if(form.Name.Contains(contain)) return true;
            return false;
        }

        #endregion


    }
}
